package core

import (
	"AsyncFlashStream/global"
	"AsyncFlashStream/initialize"
	"fmt"
	"go.uber.org/zap"
)

type server interface {
	ListenAndServe() error
}

// RunWindowsServer
// @Author Cat
// @Description: 初始化http服务
func RunWindowsServer() {
	//初始化gin路由
	gin := initialize.Routers()
	//配置静态
	gin.Static("/app", "./web/app")
	//启动服务
	address := fmt.Sprintf(":%d", global.G_CONFIG.System.Addr)
	s := initServer(address, gin)
	global.G_LOG.Info("server run success on ", zap.String("address", address))
	err := s.ListenAndServe()
	if err != nil {
		global.G_LOG.Error("启动http服务异常", zap.Error(err))
	}
}
